package com.xianyun.book.domain.order;

import com.alibaba.cola.exception.BizException;

/**
 * @author ytt
 */
public enum OrderType {
    /**销售方*/
    SELLER(0),
    /**买方*/
    BUYER(1);
    /**订单类型*/
    private Integer orderType;

    OrderType(Integer orderType) {
        this.orderType = orderType;
    }

    public Integer getOrderType() {
        return orderType;
    }

    public static OrderType getOrderTypeByTypeId(Integer typeId){
        for (OrderType type:values()){
            if (typeId.equals(type.orderType)){
                return type;
            }
        }
        throw new BizException("订单类型不存在");
    }
}
